import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex);

const store = new Vuex.Store({
    state: {
        topics: [],
        topic: {}
    },
    mutations: {
        getTopic(state, playload) {
            state.topics.forEach(function(item){
                if(item.id === playload) {
                    console.log("成功获取指定 id 文章");
                    state.topic = item;
                }
            });
        }
    }
})

export default store